class BaseModel {
    constructor(data, message) {
        if (typeof data === "string") {
            this.message = data;
            data = null;
            message = null;
        }
        if (data) {
            this.data = data;
        }
        if (message) {
            this.message = message;
        }
    }
}

class SuccessModel extends BaseModel {
    constructor(data, message) {
        super(data, message);
        this.errno = 0;
    }
}

class ErrorModel extends BaseModel {
    static Errors = {
        LoginRequired: -2,
    }
    constructor(data, message, errno = -1) {
        super(data, message);
        this.errno = errno;
    }
}

module.exports = {
    SuccessModel,
    ErrorModel,
};
